
//	Tag	Description	DataType	Content	Notes				

function GetBogusFileTags(a)
{
	flashpoint();

	printf('# uses camera tags instead of filetags to check if ');
	printf('# there are any undocumented file tags ');
	printf('# API: GetFileTags(path, file-name ,tag,return-value ) ');
	printf('# Reads u-tag information embedded in .jpg, .fpx files ');
	printf('# Select file from the option menu ');
	printf('# OUTPUT FORMAT: ');
	printf('# tag [status] value ');
	printf('# value may be in decimal(hex) or string format ');
	printf('# use this program in conjunction with SetUserFileTag ');
	printf('# to retrieve the u-tag values embedded in an image file ');
	printf(' ');
	printf(' ');
	
  writeMenu('"GetFileTags"','"CMD"','"GetBogusFileTags()"');
  writeVariables();
  
 	printf('declare u: filecount');
 	printf('# GetFileInfo parameters ');
	printf('declare s: spath,fname');
	printf('declare u: ulength ');
	printf('declare b: bstatus' );
 	printf(' ');
 	printf('declare s: selectedFile ');
 	
	printf('<br>','#**** OPEN FILE ****');  
	printf('outFile="/System/ZGBFTag.txt"');
	writeFileOpen();

	printf(' ');
	printf('WriteLine(fd," API: GetFileTags(path, file-name ,tag,return-value ) ")');
	printf('WriteLine(fd," Reads u-tag information embedded in .jpg, .fpx files ")');
	printf('WriteLine(fd," Select file from the option menu ")');
	printf('WriteLine(fd," OUTPUT FORMAT: ")');
	printf('WriteLine(fd," tag [status] value ")');
	printf('WriteLine(fd," value may be in decimal(hex) or string format ")');
	printf('WriteLine(fd," use this program in conjunction with SetUserFileTag ")');
	printf('WriteLine(fd," to retrieve the u-tag values embedded in an image file ")');
	printf(' ');
	

	printf('# DEFAULT file *************');
	printf('GetFileCount(filecount) ' );
 	printf('status = GetFileInfo(0,spath,selectedFile,ulength,bstatus)  ');

	printf('OPTIONLOOP:');
	printf('DisplayClear()');
	printf('SetOption(1, "Select a file",1) ');
	printf('SetOption(2, "Selected  file",0) ');
 	printf('SetOption(3, "Display some tags",0) '); 
 	printf('SetOption(4, "Display user tags",0)' );	
 	printf('SetOption(5, "Display all tags ",0) ');
 	printf('SetOption(100, "Quit ",0) ');
 	printf('GetOption(choice) ');

 	printf('if choice == 100 ');
 	printf('exitscript ');
 	printf('end ');

	printf('# choice 1 *****************************************' );
	printf('# LIST ALL AVAILABLE IMAGE FILES .JPG OR .FPX *****' );
 	printf('if choice == 1  ');

 	printf('GetFileCount(filecount) ' );
 	printf('if filecount==0  ');  
 	printf('DisplayLine( "no files")  ');
	printf('Wait(5000);');
 	printf('goto OPTIONLOOP  ');
 	printf('end	  ');
	
	printf(' ');
	printf('# PLACE FILES INTO OPTION MENU');
	printf('findex=0  ');
	printf(' ');
 	printf('GETANOTHERFILE:');

 	printf('status = GetFileInfo(findex,spath,fname,ulength,bstatus)  ');


 	printf('SetOption(findex, fname ,0)  ');

 	printf('if findex < filecount - 1  ');
 	printf('findex = findex + 1  ');
 	printf('goto GETANOTHERFILE  ');
 	printf('end  ');

 	printf('SetOption(1000, "Quit ",0)  ');
 	printf('GetOption(choice1)  ');
 	printf('	if choice1 != 1000  ');
 	printf('	GetFileInfo(choice1,spath,selectedFile,ulength,bstatus)  ');
 	printf('	end  ');
	printf(' ');
	printf(' goto OPTIONLOOP ');
 	printf('	end  ');
	printf('# END OF CHOICE 1 **********');
	
	printf('	if choice == 2 ');
 	printf('	DisplayLine("**",selectedFile,"**")  ');
	printf('	Wait(2000) ');
	printf(' goto OPTIONLOOP ');
	printf('	end ');
	printf('# END OF CHOICE 2 ******************* ');
	
	printf('	if choice == 3 ');
 	printf('	status=GetFileTag(spath,selectedFile,"grct",uvar) ');
 	printf('	DisplayLine("**",selectedFile,"**")  ');
 	printf('	DisplayLine("grct[",status,"] ", uvar)  ');
	printf('	Wait(2000) ');
	printf(' goto OPTIONLOOP ');	
	printf('	end ');
	printf('# END OF CHOICE 3 ******************* ');
	
	printf('# IF THIS FAR, MUST BE CHOICE 4 or 5');
 	printf('# *************************** ');

 	printf(' ');
 	printf('count=0 ');
 	printf('if choice == 4');
 	printf('count=44');
 	printf('end');
 	
	printf(' ' );
 	printf('LOOPALLTAGS: <br>');
 	printf(' count=count+1 ');
	printf('  ' );

	// note that this function is passed a different array
	// than the Capabilities functions
	// fileTagArray is passed to this function
	loopDisplayLineType(a);

	printf('     svar = ""' );
	printf('     uvar = 0 ' );
	printf('     status= 0 ');
	printf(' 	if theType == "String" ');
 	printf('	status=GetFileTag(spath,selectedFile,param,svar) ');
	printf(' 	DisplayLine(count,") ",param,"[",status,"] ",svar) ');
	printf(' 	WriteLine(fd,count,") ",param,"[",status,"] ",svar) ');
	
	printf(' 	end ');
	
	printf(' 	if theType != "String" ');
 	printf('	status=GetFileTag(spath,selectedFile,param,uvar) ');
 	printf('	bvar = uvar ');
	printf(' 	Display(count,") ",param,"[",status,"] ",uvar )');
	printf(' 	DisplayLine( "(",bvar,")" )');
	
	printf('	Write(fd,count,") ",param,"[",status,"] ",uvar ) ');
	printf('	WriteLine(fd,"(",bvar,")" ) ');

	printf(' 	end ');

	printf(' if count < ',a.length );
	printf(' Wait(100) ');
	printf(' goto LOOPALLTAGS ');
	printf(' end ');
	
	writeFileClose();
	printf('exitscript');

}
						
				

function SetBogusUserFileTag(a)
{
	flashpoint();


	printf('# API: SetUserFileTag(path, file-name ,tag,value ) ');
	printf('# Stores information  into .jpg, .fpx files ');
	printf('# Select the file from the option menu ');
	printf('# OUTPUT FORMAT: ');
	printf('# tag [status1][status2] value ');
	printf('# status1 = return status from SetUserFileTag() ');
	printf('# status2 = return status from GetUserFileTag() ');
	printf('# an obvious string is stored into string utags ');
	printf('# and an int is stored into a UInt tag ');
	printf('# the int is readily obvious in the output ');
	printf('# ');
	
	printf(' ');
	printf(' ');

  writeMenu('"SetFileTags"','"CMD"','"SetFileTags()"');
  writeVariables();
 	printf('declare u: filecount');
 	printf('# SetFileInfo parameters ');
	printf('declare s: spath,fname');
	printf('declare u: ulength ');
	printf('declare b: bstatus' );
 	printf(' ');
 	printf('declare s: selectedFile ');
 	
	printf('<br>','#**** OPEN FILE ****');  
	printf('outFile="/System/ZSFTag.txt"');
	writeFileOpen();

	printf(' ');
	printf('WriteLine(fd," ")');
	printf('WriteLine(fd," API: SetUserFileTag(path, file-name ,tag,value ) ")');
	printf('WriteLine(fd," Stores information  into .jpg, .fpx files ")');
	printf('WriteLine(fd," Select the file from the option menu ")');
	printf('WriteLine(fd," OUTPUT FORMAT: ")');
	printf('WriteLine(fd," tag [status1][status2] value ")');
	printf('WriteLine(fd," status1 = return status from SetUserFileTag() ")');
	printf('WriteLine(fd," status2 = return status from GetUserFileTag() ")');
	printf('WriteLine(fd," a obvious string is stored into string utags ")');
	printf('WriteLine(fd," and an int is stored into a UInt tag ")');
	printf('WriteLine(fd," the int is readily obvious in the output ")');
	printf('WriteLine(fd," ")');
	printf(' ');

	printf('# DEFAULT file *************');
	printf('GetFileCount(filecount) ' );
 	printf('status = GetFileInfo(0,spath,selectedFile,ulength,bstatus)  ');

	printf('OPTIONLOOP:');
	printf('DisplayClear()');
	printf('SetOption(1, "Select a file",1) ');
	printf('SetOption(2, "Selected  file",0) ');
 	printf('SetOption(3, "Display some tags",0) '); 	
 	printf('SetOption(4, "Set all u-type tags ",0) ');
 	printf('SetOption(100, "Quit ",0) ');
 	printf('GetOption(choice) ');

 	printf('if choice == 100 ');
 	printf('exitscript ');
 	printf('end ');

	printf('# choice 1 *****************************************' );
	printf('# LIST ALL AVAILABLE IMAGE FILES .JPG OR .FPX *****' );
 	printf('if choice == 1  ');

 	printf('GetFileCount(filecount) ' );
 	printf('if filecount==0  ');  
 	printf('DisplayLine( "no files")  ');
	printf('Wait(5000)');
 	printf('goto OPTIONLOOP  ');
 	printf('end	  ');
	
	printf(' ');
	printf('# PLACE FILES INTO OPTION MENU');
	printf('findex=0  ');
	printf(' ');
 	printf('GETANOTHERFILE:');

 	printf('status = GetFileInfo(findex,spath,fname,ulength,bstatus)  ');


 	printf('SetOption(findex, fname ,0)  ');

 	printf('if findex < filecount - 1  ');
 	printf('findex = findex + 1  ');
 	printf('goto GETANOTHERFILE  ');
 	printf('end  ');

 	printf('SetOption(1000, "Quit ",0)  ');
 	printf('GetOption(choice1)  ');
 	printf('	if choice1 != 1000  ');
 	printf('	GetFileInfo(choice1,spath,selectedFile,ulength,bstatus)  ');
 	printf('	end  ');
	printf(' ');
	printf(' goto OPTIONLOOP ');
 	printf('	end  ');
	printf('# END OF CHOICE 1 **********');
	
	printf('	if choice == 2 ');
 	printf('	DisplayLine("**",selectedFile,"**")  ');
	printf('	Wait(2000) ');
	printf(' goto OPTIONLOOP ');
	printf('	end ');
	printf('# END OF CHOICE 2 ******************* ');
	
	printf('	if choice == 3 ');
 	printf('	status=GetFileTag(spath,selectedFile,"grct",uvar) ');
 	printf('	DisplayLine("**",selectedFile,"**")  ');
 	printf('	DisplayLine("grct[",status,"] ", uvar)  ');
	printf('	Wait(2000) ');
	printf(' goto OPTIONLOOP ');	
	printf('	end ');
	printf('# END OF CHOICE 3 ******************* ');
	
	printf('# IF THIS FAR, MUST BE CHOICE 4 ');
 	printf('# *************************** ');	
 	printf(' ');


	// to save user time, start count just before first "u"-type tag
 	var k=1;
 	while( a[k].param.substring(1,2) != "u" ) 
	 k++;
	printf('# skip a lot of non u-types');
 	printf('count= ',k-1);
 	printf('LOOPALLTAGS: <br>');
	printf('theType="" ' );
 	printf(' count=count+1 ');
	printf('  ' );

	for( i=1 ; i<a.length ; i++ )
	{
		if( a[i].param.substring(1,2) != "u" ) continue;
		
		// skip all these if not a "u" type 
			printf(' if count==',i);
			printf(' param=', a[i].param );
			
			// NOTE: no switch before Netscape 4.0, so don't use switch!
			if( (a[i].type=="String") ||(a[i].type=="DosName") || (a[i].type=="PName") )
				printf('theType = "String" ' );
			else if( a[i].type=="UInt" )
				printf('theType = "UInt" ');
			
			
			printf(' end ');	
		
	}


	printf(' 	if theType == "String" ');
	printf('	svar="George Bush"');
 	printf('	status=SetUserFileTag(spath,selectedFile,param,svar) ');
 	printf('	svar=" "');
 	printf('	status1=GetFileTag(spath,selectedFile,param,svar) ');
	printf(' 	DisplayLine(count,") ",param,"[",status,"][",status1,"] ",svar) ');
	printf(' 	WriteLine(fd,count,") ",param,"[",status,"][",status1,"] ",svar) ');	
	printf(' 	end ');
	
	printf(' 	if theType == "UInt" ');
	printf('#	use count as a sample value ');
	printf('	uvar=count');
 	printf('	status=SetUserFileTag(spath,selectedFile,param,uvar) ');
 	printf('	uvar=0');
 	printf('	status1=GetFileTag(spath,selectedFile,param,uvar) ');
	printf(' 	DisplayLine(count,") ",param,"[",status,"][",status1,"] ",uvar) ');
	printf(' 	WriteLine(fd,count,") ",param,"[",status,"][",status1,"] ",uvar) ');	
	printf(' 	end ');
	

	printf(' if count < ',a.length );
	printf(' Wait(100) ');
	printf(' goto LOOPALLTAGS ');
	printf(' end ');
	
	writeFileClose();
	printf('exitscript');

}
						
						
